function Box () {
	this.collectAddr = '000000000';
	this.BoxAddr = ' ';
	this.BoxNo = ' ';
	this.ParentAddr = ' ';
	this.CT = 1;
	this.WiringId = 1;
}
Box.prototype.getBoxAddr = function(val){
	this.BoxAddr = val;
}

Box.prototype.getBoxNo = function(val){
	this.BoxNo = val;
}

Box.prototype.getParentAddr = function(val){
	this.ParentAddr = val;
}

Box.prototype.getWiringId = function(val){
	this.WiringId = val;
}

Box.prototype.save = function(){
	let that = this;
	that.collectAddr = CommonUtil.getStorage('selCollectAddr');
	let sqlStr = "select * from Box where BoxAddr = '"+this.BoxAddr+"'";
	DB.selectSQL(sqlStr,function(data){
		if(data.length <= 0){
			let intoSql = 'INSERT INTO Box VALUES ("'+that.collectAddr;
			intoSql = intoSql +'", "'+that.BoxAddr;
			intoSql = intoSql +'", "'+that.BoxNo;
			intoSql = intoSql +'","'+that.ParentAddr;
			intoSql = intoSql +'", '+that.CT;
			intoSql = intoSql +', '+that.WiringId;
			intoSql = intoSql +')';
			console.log(intoSql);
			DB.insertToSQL(intoSql,function(data){
				if(data == 'success'){
					CommonUtil.createElementHTML("UL",that.BoxAddr + '::数据成功保存',"getResult");
				}else if(data == 'fail'){
					CommonUtil.createElementHTML("UL",that.BoxAddr + '::数据保存失败',"getResult");
				}
			});
		}else{
			CommonUtil.createElementHTML("UL",that.BoxAddr + '::已存在',"getResult");
		}
	});
}

